package com.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pojo.Archive;
import com.pojo.Log;
import com.service.TongjiService;

@Controller
public class TongjiController {
	TongjiService service1 = new TongjiService();
	
	/*统计上传数量*/
	@RequestMapping(value = "/tongjishangchuan.action", method = RequestMethod.GET)
	@ResponseBody
	public List<Map> tongjishangchuan(
		@CookieValue(value="ID",defaultValue="")String userId,
			HttpServletResponse response
			){
		/*从Cookie中取出id*/
	       List<Map> list = service1.tongjishangchuan();
				return list;	
	}
	/*显示最近添加的档案*/
	@RequestMapping(value = "/zjtjst.action", method = RequestMethod.GET)
	@ResponseBody
	public List<Archive> zjtjst(){
		List<Archive> list = service1.zjtjst();
		return list;
	}
	/*显示最近浏览过的档案*/
	@RequestMapping(value = "/zuijinlook.action", method = RequestMethod.GET)
	@ResponseBody
	public List<Archive> zuijinlook(
			@CookieValue(value="ID",defaultValue="")String userId,
			HttpServletResponse response
			){
		List<Archive> list = service1.zuijinlook(userId);
				return list;
	}
	/*某一个时间段用户上传档案的数量*/
	@RequestMapping(value = "/timesc.action", method = RequestMethod.GET)
	@ResponseBody
	public List<Map> timesc(
			@RequestParam(value="date1",defaultValue="")String date1,
			@RequestParam(value="date2",defaultValue="")String date2
			){
		List<Map> list = service1.timesc(date1, date2);
		return list;

	}
}
